<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>选择角色</title>
<script type="text/javascript" src="${path}/js/scripts/bootstart.js"></script>
</head>
<body>
	<div id="rolegrid" class="mini-datagrid"
		style="width: 100%; height: 280px;"
		url="${path}/role/mgr/showList" pageSize="10"
		totalField="totalRecord" allowResize="false" idField="roleId"
		sizeList="[10,20,30]" multiSelect="true" dataField="list"
		borderStyle="border-left:0;border-right:0;" sortField="role_id"
		sortOrder="desc">
		<div property="columns">
			<div type="checkcolumn"></div>
			<div field="roleName" width="60" headerAlign="center" allowSort="true">角色名称</div>
			<div field="addTime" width="80" headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss">添加时间</div>
			<div field="roleDesc" width="100" headerAlign="center">角色描述</div>
		</div>
	</div>
	<div style="text-align: center; padding: 10px;">
		<a class="mini-button" style="width: 60px;" onclick="onOk()">确定</a> <span
			style="display: inline-block; width: 25px;"></span> <a
			class="mini-button" style="width: 60px;" onclick="onCancel()">取消</a>
	</div>
</body>
<script type="text/javascript" src="${path}/js/scripts/datagrid.js"></script>
<script type="text/javascript">
	mini.parse();
	$(function() {
		$.grid.init({
			id : "rolegrid"
		});
	});
	function CloseWindow(action) {
		if (window.CloseOwnerWindow)
			return window.CloseOwnerWindow(action);
		else
			window.close();
	}

	function GetData() {
		var rows = $.grid.datagrid.getSelecteds();
		var ids = [], texts = [];
		for (var i = 0, l = rows.length; i < l; i++) {
			var row = rows[i];
			ids.push(row.roleId);
			texts.push(row.roleName);
		}
		var data = {};
		data.id = ids.join(",");
		data.text = texts.join(",");
		return data;
	}

	function onOk() {
		var rows = $.grid.datagrid.getSelecteds();
		if (rows.length == 0) {
			mini.alert("请至少选择一个角色！");
			return;
		}
		CloseWindow("ok");
	}
	function onCancel() {
		CloseWindow("cancel");
	}
	function roleType(e){
		if(e.value==1){
			return "系统管理员";
		}else if(e.value==2){
			return "校园代理";
		}else {
			return "其他";
		}
	}
</script>
</html>
